def make_chocolate(small, big, goal):
  if small+big*5==goal:
    return small
  else:
    if goal/5>=big and small>=goal-big*5:
      return goal-big*5
    else:
      if goal/5>=big and small <goal-big*5:
        return-1
      else:
        if goal/5<big  and small>=goal:
          return goal
        else:
          if goal/5<big and small<goal and small>=goal-(goal//5*5):
            return goal-(goal//5*5)
          else:
            return small-(goal-(goal//5*5))
